Skip to content

fix(workbench): persist Pro conversation titles - #1273

Merged
wyuc merged 13 commits into
THU-MAIC:mainfrom
YizukiAme:codex/fix-pro-session-title
Aug 31, 2026
Merged

fix(workbench): persist Pro conversation titles#1273
wyuc merged 13 commits into
THU-MAIC:mainfrom
YizukiAme:codex/fix-pro-session-title

Conversation

@YizukiAme

@YizukiAme YizukiAme commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Persist manual Pro conversation titles end to end so a rename survives reloads and cannot be rolled back by later owner-session status updates.

Related Issues

Fixes #1263

Changes

  • Add a nullable agent_sessions.title column with an idempotent upgrade path and expose an additive AgentSessionTitleStore capability without changing AgentSessionStore.
  • Add the missing owner-scoped PATCH /api/agent/sessions/:id route with strict validation, trim/120-character normalization, blank-to-null clearing, and uniform not-found behavior.
  • Update the OwnerSessionClient authoritative snapshot during optimistic rename, server settle, and rollback; request one no-loading reconciliation after a changed successful write.
  • Fence session-detail title bootstraps with a per-session revision so an older response cannot overwrite a rename or explicit clear made while it was in flight.
  • Add real PGlite migration/isolation coverage, route boundary tests, and a shell regression test for the late status-event rollback race.
  • Bump @openmaic/storage from 0.26.0 to 0.26.1.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Verification

Steps to reproduce / test

  1. Rename a Pro conversation from the rail or attached header and reload the workspace.
  2. Clear the title and verify the original prompt-derived fallback returns.
  3. Deliver a later owner session_status update and verify it does not restore the previous title.
  4. Delay the initial session-detail response, rename before it arrives, and compare the rail, attached header, and stored title after release.

What you personally verified

  • Previous-head full verification: Node 22 package/dependency gates, Prettier, root TypeScript, i18n, ESLint, production build, root Vitest (7051 passed, 26 skipped), and package suites all passed.
  • Current-head focused verification: all 77 workbench files passed (990 tests); root TypeScript, changed-file ESLint, Prettier, and diff checks passed.
  • Manual browser verification against local PostgreSQL 16: rename + reload passed; clear + reload restored the prompt fallback.
  • Deterministic delayed-response verification passed: after an older session-detail response carrying Race Start was captured, the title was changed to Race New; releasing the old response left the rail, attached header, and database on Race New. The same check passed for an explicit clear, preserving the prompt fallback instead of restoring the stale title.

Evidence

  • Local verification results are summarized above; all four GitHub checks passed for the latest head.
  • CI passes (pnpm check && pnpm lint && npx tsc --noEmit)
  • Manually tested locally, including delayed session-detail responses during rename and clear
  • Screenshots / recordings attached (if UI changes)

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have added/updated documentation as needed
  • My changes do not introduce new warnings

@wyuc wyuc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three correctness races remain in title reconciliation. They can lose a newer rename, admit stale metadata after navigation, or leave open clients showing an obsolete title. Please address these interleavings and add deterministic regression coverage before merging.

Comment thread components/workbench/workspace/WorkspaceShell.tsx Outdated
Comment thread lib/workbench/use-workbench-session.ts
Comment thread components/workbench/workspace/WorkspaceShell.tsx Outdated
@YizukiAme
YizukiAme force-pushed the codex/fix-pro-session-title branch from f34e51d to 7a97f1b Compare August 29, 2026 16:15
@YizukiAme

Copy link
Copy Markdown
Collaborator Author

Thanks for the careful review! I’ve addressed all three threads and added regression coverage for the relevant request ordering, navigation, snapshot, and cross-tab scenarios.

@YizukiAme
YizukiAme force-pushed the codex/fix-pro-session-title branch from 7a97f1b to d02f9e0 Compare August 30, 2026 06:35
@YizukiAme
YizukiAme requested a review from wyuc August 30, 2026 09:23

@wyuc wyuc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One title-reconciliation race remains: a snapshot can start after the optimistic decision but still read before its PATCH commits. Please keep unresolved writes authoritative until their settlement is known and add the corresponding ordering test.

Comment thread lib/workbench/owner-session-client.ts Outdated
@YizukiAme

Copy link
Copy Markdown
Collaborator Author

Addressed — write settlement is tracked separately from the optimistic decision now, so a snapshot that started before the PATCH resolved can no longer fence it, and the ordering tests cover both directions. Also in this range: a title event hidden by an unconfirmed mutation schedules its own reconciliation instead of waiting for the periodic fetch, a post-settlement snapshot that omits the session retires its mutation, and the rename queue survives a shell remount. 26a0b01 is documentation only — it records that a title change counts as rail activity, the same semantics rename_stage already has for courses, plus a two-session ordering test.

@YizukiAme
YizukiAme requested a review from wyuc August 30, 2026 20:30

@wyuc wyuc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reported title-reconciliation races are addressed with explicit write-settlement tracking and deterministic ordering coverage. CI is green.

@wyuc
wyuc merged commit 9d16e68 into THU-MAIC:main Aug 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Pro conversation rename UI calls a missing PATCH endpoint and cannot persist titles

2 participants